﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PMS.ENT;
using PMS.DAL;

namespace PMS.BLL
{
    public class ScheduleItemBLL
    {
        #region Get
        public static ScheduleItemENT GetScheduleItemByID(int scheduleItemID)
        {
            try
            {
                return ScheduleItemDAL.GetScheduleItemByID(scheduleItemID);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static ScheduleItemCollection GetScheduleItemList(string orderBy, string orderDirection, int page, int pageSize, out int totalRecords)
        {
            try
            {
                return ScheduleItemDAL.GetScheduleItemList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static ScheduleItemCollection GetScheduleItemListByScheduleID(int scheduleID)
        {
            try
            {
                return ScheduleItemDAL.GetScheduleItemListByScheduleID(scheduleID);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static ScheduleItemCollection GetScheduleItemListByScheduleGroupID(int scheduleGroupID, out int groupID, out int projectOwnerID, out int task, out decimal percent, out decimal total)
        {
            try
            {
                return ScheduleItemDAL.GetScheduleItemListByScheduleGroupID(scheduleGroupID, out groupID, out projectOwnerID, out task, out percent, out total);
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static ScheduleItemCollection GetScheduleItemListForCMB(int userID, int projectID)
        {
            try
            {
                ScheduleItemCollection listScheduleItem = new ScheduleItemCollection();
                listScheduleItem.Add(new ScheduleItemENT { ScheduleItemID = 0, Work = string.Empty });
                listScheduleItem.AddRange(ScheduleItemDAL.GetScheduleItemListForCMB(userID, projectID));
                return listScheduleItem;
            }
            catch (Exception)
            {

                throw;
            }
        }

        public static ScheduleItemCollection GetScheduleItemListForReport(int groupID, int projectID, int semesterID, out int task, out decimal percent, out decimal total)
        {
            try
            {
                return ScheduleItemDAL.GetScheduleItemListForReport(groupID, projectID, semesterID, out task, out percent, out total);
            }
            catch (Exception)
            {
                
                throw;
            }
        }

        #endregion

        #region Validate
        public static bool CheckScheduleItemStatus(int[] ScheduleItemID, string status)
        {
            try
            {
                return ScheduleItemDAL.CheckScheduleItemStatus(ScheduleItemID, status);
            }
            catch (Exception)
            {

                throw;
            }
        }
        #endregion
    }
}
